<?php
/**
 */
class UserDetailsTable extends Doctrine_Table
{
		public function updateUserDetails($memberid,$_POST,$fsname)
		{
			  $tag_line=$_POST['tag_line'];
			  $description=$_POST['description'];
			  $occupation=$_POST['occupation'];
			  $employee=$_POST['employee'];
			  $employee_title=$_POST['employee_title'];
			  $employee_sdate=date("Y-m-d",strtotime($_POST['employee_sdate']));
			  $employee_edate=date("Y-m-d",strtotime($_POST['employee_edate']));
			  $education=$_POST['education'];
			  $estudy=$_POST['estudy'];
			  $education_sdate=date("Y-m-d",strtotime($_POST['education_sdate']));
			  $education_edate=date("Y-m-d",strtotime($_POST['education_edate']));
			  $rel_type=$_POST['rel_type'];
		$query = new Doctrine_Query();
				$query->update('UserDetails')
					  ->set('photo',"'".$fsname."'")
					  ->set('tag_line',"'".$tag_line."'")
					  ->set('description',"'".$description."'")
					  ->set('occupation',"'".$occupation."'")
					  ->set('employee',"'".$employee."'")
					  ->set('employee_title',"'".$employee_title."'")
					  ->set('employee_sdate',"'".$employee_sdate."'")
					  ->set('employee_edate',"'".$employee_edate."'")
					  ->set('education',"'".$education."'")
					  ->set('estudy',"'".$estudy."'")
					  ->set('education_sdate',"'".$education_sdate."'")
					  ->set('education_edate',"'".$education_edate."'")
					  ->set('rel_type',"'".$rel_type."'")
					  ->where("user_id='".$memberid."'");
					  //echo $query;exit;
				return $query->execute();
		}
		public function getUserDetails($memid)
	 {
		$query=new Doctrine_Query();
		    $query->select('u.*')
		       ->from('UserDetails u')
			   ->where("u.user_id='".$memid."'");
			     //echo $query;exit;
			   	$result = $query->execute();
				//echo '<pre>';print_r($result);exit;
				return $result[0];
	 }
	 public function getPhotos($memid)
	 {
		$query=new Doctrine_Query();
		    $query->select('u.photo')
		       ->from('UserDetails u')
			   ->where("u.user_id='".$memid."'");
			     //echo $query;exit;
			   	$result = $query->execute(array(),Doctrine::HYDRATE_ARRAY);
				//echo '<pre>';print_r($result);exit;
				return $result[0];
	 }
	 public function updateProfileImage($memid,$photo)
	 {
		
		$query=new Doctrine_Query();
		    $query->update('UserDetails u')
		       ->set('u.photo',"'".trim($photo)."'")
			   ->where("u.user_id='".$memid."'");
			     //echo $query;exit;
			   return $result = $query->execute();
				//echo '<pre>';print_r($result);exit;
				
	 }
}